package ng.test;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.io.IOException;

import lib.Config;
import lib.scrren.DisplayAble;
import ng.Game;
import ng.graphics.Camera;
import ng.lib.Utils;
import ng.lib.Vector2D;
import ng.map.Map;
import ng.map.MapObject;
import ng.map.MapObjectDynamic;
import ng.map.elements.ParticleEffect;
import ng.map.elements.objects.BlackHole;
import ng.map.elements.objects.Rocket;
import ng.map.elements.objects.Spacecraft;
import ng.map.elements.objects.Wabber;

public class FullScreen extends DisplayAble {

	public final static int TICK_DURING = 10;
	public final Game game;
	
	public FullScreen() {
		this.game = new Game(Config.xRes,Config.yRes);
		this.setKeyAdapter(this.game.getKeyAdabter());
		this.startDrawing();
	}

	
	@Override
	synchronized public String draw(Graphics2D g) {
		long ms = System.currentTimeMillis();
		
		this.game.tick();
		this.game.draw(g);
		
		while (TICK_DURING > System.currentTimeMillis() - ms)
			try {
				Thread.sleep(1);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

	
		return "";
	
	}
	
	public static void main(String[] args) {
		new FullScreen();
	}


}
